/**
 * 兑换码
 */

import i18n from '../../../i18n';
const dhm = [i18n.t('dhm.dhm1', { lng: 'zh-CN' })];
export class DHM {
  /**
   * 兑换码
   */
  static async exchangeCode(entity: GamePlayerEntity) {
    const d1 = await entity.player.dialog<GameInputDialogParams>({
      type: GameDialogType.INPUT,
      title: i18n.t('dhm.title', { lng: entity.language }),
      content: i18n.t('dhm.content', { lng: entity.language }),
    });
    if (d1) {
      if (dhm.includes(d1)) {
        entity.player.directMessage(
          i18n.t('dhm.success', { lng: entity.language })
        );
        switch (d1) {
          case dhm[0]:
            entity.coin += 26000;
            break;
        }
      } else {
        entity.player.directMessage(
          i18n.t('dhm.error', { lng: entity.language })
        );
      }
    }
  }
}
